#ifndef COMPUTING_PERCEPTION_LIDAR_LSHAPE_SECOND_H
#define COMPUTING_PERCEPTION_LIDAR_LSHAPE_SECOND_H

#include "common/algorithm_type/lidar_cell_objs_type.h"
#include "common/algorithm_type/lidar_cell_type.h"
#include "common/algorithm_type/lidar_points_type.h"
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <vector>
namespace perception
{
    namespace algorithm
    {
        enum Cost
        {
            AREA = 0,
            CLOSENESS = 1,
            VARIANCE = 2
        };
        class LShape2
        {
        public:
            /// The construct methord of the class Classify.
            LShape2();
            ~LShape2();
            float Compute(std::vector<data_cell> &cells);
            float Compute(XYZI &points);
            void CoordinateTransformation(std::vector<data_cell> &cells, float &rad);
            void CoordinateTransformation(XYZI &cells, float &rad);

        private:
            float th_rad = 5.0; // 正负阈值
            // const float deg2rad = M_PI_2 / 90.0;
            // const float rad2deg = 90.0 / M_PI_2;
            int cost_type = Cost::CLOSENESS;
            const float min_closter = 0.1 * 0.1;
            const float max_closter = 0.4 * 0.4;
            void ComputeMaxMin(std::vector<data_cell> &cells, std::vector<float> &max_min);
            float CalcClosenessCriterion(std::vector<data_cell> &cells);
            float CalcVarianceCriterion(std::vector<data_cell> &cells);
            float CalcAreaCriterion(std::vector<data_cell> &cells);

            void ComputeMaxMin(XYZI &cells, std::vector<float> &max_min);
            float CalcClosenessCriterion(XYZI &cells);
            float CalcVarianceCriterion(XYZI &cells);
            float CalcAreaCriterion(XYZI &cells);
        };
    } // namespace perception
} // namespace avos
#endif // COMPUTING_PERCEPTION_LIDAR_PROCESS_CLASSIFY_CLASSIFY_